package cn.service.impl;

import cn.dao.UserDao;
import cn.entity.User;
import cn.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service("userService")
public class UserServiceImpl implements UserService {

    @Autowired(required = false)
    @Resource
    private UserDao dao;

    public UserDao getDao() {
        return dao;
    }
    @Autowired
    @Resource
    public void setDao(@Qualifier("userDao") UserDao dao) {
        this.dao = dao;
    }

    public UserServiceImpl() {
    }

    @Autowired
    public UserServiceImpl(@Qualifier("userDao") UserDao dao) {
        this.dao = dao;
    }

    @Override
    public void addNewUser(User user) {
        dao.save(user);
    }
}
